﻿package de.gameduell.framework.gui.wrapper {
	import flash.display.DisplayObject;
	import flash.geom.Point;
	import flash.geom.Rectangle;	

	/**
	 * @author cbra
	 */
	public class DisplayObjectWrapper extends EventDispatcherWrapper {

		protected var _displayObject:DisplayObject;
		protected var _position:Point;
		
		public function DisplayObjectWrapper(aDisplayObject:DisplayObject) {
			super(aDisplayObject);
			_displayObject = aDisplayObject;
			_position = new Point(x,y);
		}
		
		public function get name():String{
			return _displayObject.name;
		}
		
		public function get mask():DisplayObject{
			return _displayObject.mask;
		}
		
		public function set mask(aMask:DisplayObject):void{
			 _displayObject.mask = aMask;
		}
		
		public function set name(aName:String):void{
			 _displayObject.name = aName;
		}
		
		public function set x(aX:Number):void{
			_displayObject.x = aX;
			_position.x = aX;
		}

		public function set y(aY:Number):void{
			_displayObject.y = aY;
			_position.y = aY;
		}
		
		public function set position(pos:Point):void{
			_position = pos;
			x = pos.x;
			y = pos.y;
		}
		
		public function get position():Point{
			return new Point(x,y);
		}
		
		public function getBounds(aDisplayObject:DisplayObject):Rectangle{
			return _displayObject.getBounds(aDisplayObject);
		}
		
		public function hitTestPoint(x:Number, y:Number, shapeFlag:Boolean = false):Boolean{
			return _displayObject.hitTestPoint(x,y,shapeFlag);
		}

		public function get x():Number{
			return _displayObject.x;
		}
		
		public function get y():Number{
			return _displayObject.y;
		}
		public function set width(aWidth:Number):void{
			_displayObject.width = aWidth;
		}
		
		public function set height(aHeight:Number):void{
			_displayObject.height = aHeight;
		}
		
		public function get width():Number{
			return _displayObject.width;
		}
		
		public function get height():Number{
			return _displayObject.height;
		}
		
		public function set visible(isVisible:Boolean):void{
			_displayObject.visible = isVisible;
		}
		
		public function get visible():Boolean{
			return _displayObject.visible;
		}

		public function set rotation(aRotation:Number):void{
			_displayObject.rotation = aRotation;
		}
		
		public function get rotation():Number{
			return _displayObject.rotation;
		}
		
		public function get parent():DisplayObject{
			return _displayObject.parent;
		}
		
		public function globalToLocal(point:Point):Point{
			return _displayObject.globalToLocal(point);
		}
		
		public function localToGlobal(point:Point):Point{
			return _displayObject.localToGlobal(point);
		}
	}
}
